/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.uoc.tdp.pac4.beans;

import java.io.Serializable;
import java.util.Date;

/**
 *
 * @author pguerreroj
 */
public class Proveidor implements Serializable {
    private static final long serialVersionUID = 1L;
    
    private int id_proveidor;
    private String nom;
    private Date data_alta;
    private float perc_descompte;
    private int quant_descompte;

    
    public Proveidor() {
    }
       
    public Proveidor(String nom, Date data_alta, float perc_descompte, int quant_descompte) {
        this.nom = nom;
        this.data_alta = data_alta;
        this.perc_descompte = perc_descompte;
        this.quant_descompte = quant_descompte;
    }
    
    public Proveidor(int id_proveidor, String nom, float perc_descompte, int quant_descompte) {
        this.id_proveidor = id_proveidor;
        this.nom = nom;
        this.perc_descompte = perc_descompte;
        this.quant_descompte = quant_descompte;
    }

    public Proveidor(int id_proveidor, String nom, Date data_alta, float perc_descompte, int quant_descompte) {
        this.id_proveidor = id_proveidor;
        this.nom = nom;
        this.data_alta = data_alta;
        this.perc_descompte = perc_descompte;
        this.quant_descompte = quant_descompte;
    }

    public int getId_proveidor() {
        return id_proveidor;
    }    

    public String getNom() {
        return nom;
    }

    public Date getData_alta() {
        return data_alta;
    }

    public float getPerc_descompte() {
        return perc_descompte;
    }

    public int getQuant_descompte() {
        return quant_descompte;
    }

    public void setId_proveidor(int id_proveidor) {
        this.id_proveidor = id_proveidor;
    }
    
    public void setNom(String nom) {
        this.nom = nom;
    }

    public void setData_alta(Date data_alta) {
        this.data_alta = data_alta;
    }

    public void setPerc_descompte(float perc_descompte) {
        this.perc_descompte = perc_descompte;
    }

    public void setQuant_descompte(int quant_descompte) {
        this.quant_descompte = quant_descompte;
    }

    @Override
    public String toString(){
        return this.nom;
    }
    
    
    public boolean permetDescompte(int unitats){
        
        if (unitats >= this.quant_descompte) {
            return true;
        } else {
            return false;
        }
        
    }
    
    public float descuento(float importe, int unitats){
        importe = importe - ((importe * this.perc_descompte)/100);
        return importe;
    }
    
    
}
